Repository navigation
Settings, System: one press of Update does the whole job, one decision per update - #329
Merged
Merged
Conversation
Pressing Update while the release check ran showed a red error toast, a version read from before a press brought the Update button back, a double click could send two requests, and a newer release could take over the card as a second Update button while one ran. Now a press shows progress at once and can't be repeated; a press recorded while the check runs shows Checking with who pressed it; a read older than the press shows Starting until the updater shows the update; a newer release is only mentioned while one runs and offered once it ends. Error toasts are kept for real failures and say what to do; 409 states show in the card. Polling no longer drops unsaved settings, an old release list no longer reads as up to date, and the update sections come first on the page.
…nly the install's problems Update took three steps when a release changed IAM: Update, Review and apply, then Confirm and apply in a dialog of raw CloudFormation ids. The card next to Update now says one press includes changes to what Coderhelm's own roles may do (inside the permission limit) and sends that consent, so such a release goes from available to applying in one click. A prepared update shows a plain summary and one Apply update, the raw list behind Technical details, no dialog. An update that would replace or remove data says what, in words, and one clearly worded button applies exactly that. Install health no longer shows the next release's check in progress as a Warning: it is the update card's state. Optional items are a quiet Optional line, the summary matches the items listed, and a fix never links to the page it is on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Settings, System: one press of Update now does the whole job, and error toasts are kept for real failures.
The owner saw a red toast "something about signature" when pressing Update, had to press twice, and saw new Update buttons pop up. Reproduced on fixtures with screenshots before and after; the causes were:
Pressed while the release check ran: the updater refused with "try Update now again in a few minutes" and the page showed it as an error toast. With Updater: Update pressed while the release check runs starts by itself; one press applies role changes coderhelm-platform#496 the press is recorded and the update starts by itself once the check passes; the card shows Checking vX before it can be applied, who pressed and when, and "there's nothing more to press". No toast.
A read from before the press brought the Update button back: after a successful press the page read the version route once; a copy from before the press showed vX is available with an enabled Update button again. The page now shows Starting the update to vX until the updater's answer shows the update (or 90 seconds pass), reads again every 3 seconds meanwhile, and drops any version read that started before the press.
Double clicks: a second click while the first request ran could send another. One action at a time now, for Update, Roll back and Apply; the button shows progress at once and stays disabled.
A newer release while one is checked, prepared or applied: it could take over the card as a second Update to vY (while checking, the check of vX no longer matched the latest release). Now the card stays on the update in progress and only says "vY is out too; it's next after this one". It is offered once the current one finishes.
Polling dropped unsaved settings: while an update ran, every poll reset the Automatic updates form. Polls now keep what someone is changing.
An old release list said "You're up to date": now Not checked for updates lately, with when the list was last read.
Three steps for an update that changes IAM (Update, Review and apply, Confirm and apply in a dialog of raw CloudFormation ids). Now one decision, decided from how the updater classifies a prepared change set:
permission_changesonly (Coderhelm's own roles, always inside the install's permissions boundary): the text next to Update says one press includes them, the press sendsaccept_permissions, and the updater applies the change set as soon as it is prepared. Update available to Applying in one click. A prepared one (the maintenance window held it) shows "It changes what 7 of Coderhelm's own roles may do, all inside this install's permission limit" and one Apply update.data_changes(a table, bucket, user pool, key or secret replaced or removed): still stops. The card says what, in words ("The Table table in Database (replaced)"), and one clearly worded Replace the data and apply applies exactly that list (the confirm token; if the list changed since the page showed it, the updater refuses and the card shows the new one). Two clicks in all.admin_changes(the deploy role or the permissions boundary): unchanged, an AWS admin executes it in the console; Coderhelm never can.Install health repeated the update state: the next release's check in progress was listed as a Warning with a How to fix and a link to the same page, while the summary said "1 optional check not set up". Now the release check (running or stalled) is only the update card's state; optional items are a quiet "Optional: Slack. ..." line naming exactly those items; the summary matches what is listed; a fix never links to the page it is on (also on Setup checks).
Changes
src/lib/update-state.ts: a waiting press (update_request) derives checking for the pressed version; an ended press shows its reason on the offer; newstartingandstalestates;withPress,nextAfter, andfailureText(the toast text: what went wrong and what to do).src/app/settings/system/page.tsx: the press handling above; 409 answers (model check, release not ready) shown in the card, never as a toast; Roll back and the settings save use the same plain toasts; sections reordered so everything about updates comes first (Version, Automatic updates, Update history, then Install health, Models, Domain, Hybrid, Uninstall); Roll back shows why it isn't available instead of a dead button; the load error says what happened.src/components/native-update.tsx: Apply runs once per click; an Apply refused because the update moved on (applied in the AWS console, or replaced) reloads the card instead of showing an error toast; the quiet "next after this one" line.src/components/native-update.tsx(one decision): no modal;permissionRolescounts the roles a permission list touches;plainResourcesays a data change in words; Technical details holds the raw lists and the AWS console link.src/components/install-checks.tsx:samePage, no self-links.healthChecks(lib/update-state.ts) leaves the release check out of Install health and Setup checks.src/lib/api.ts:accept_permissionson Update;update_request, the Update answer'sstate, and the HTTP status onrequestWithBodyfailures (httpStatus).Audit of the other actions: Check for updates and Check again failed only on real errors (now plain toasts); Review and apply and Apply treat "it moved on" as state; Roll back's refusal ("an update is already running") is a real refusal and keeps a toast with the reason; settings saves show the updater's validation reason or "the server didn't answer". Uninstall already shows its refusal inline.
Verification
npm run lint,npm run typecheck,npm run check:openapi,npm run build.e2e/update-press.spec.ts(16 tests): press while checking shows Checking with no toast and one request; double click sends one request; a stale read shows Starting, never the button; a newer release while preparing or checking is only mentioned and no second Update button appears; the newer release is offered once after; an ended press shows its reason; a real 500 shows "Couldn't start the update: the server didn't answer (error 500). Nothing changed; try again in a minute." and Update works again; a refused model (409) and Apply after a console apply show state with no toast; settings 400 and 502 toasts, and polling keeps an unsaved change; stale list; section order; no dead Roll back button; load error.e2e/update-press.spec.tsalso: an IAM-only release goes from Update available to Applying in one click (the request carriesaccept_permissions: true, no apply call, no dialog, the wording next to the button asserted); a prepared role change shows the plain summary and one Apply update, the raw list only under Technical details; a data change takes two clicks, with "Applying it replaces or removes this data, which can't be undone:", the plain list and Replace the data and apply asserted, and the confirm token sent; the live Install health payload (release check pending plus Slack not set up) shows "All 4 checks pass", no Warning, "Optional: Slack. ..." and no self-link; a fix pointing at this page has no Open in Coderhelm link.selfhost,update-statesupdated for the one-decision card (no dialog).e2e/update-state-derive.spec.ts: 8 new cases for the press, the newer release, the hold, the stale list and the toast text.update-states,models-switch,selfhostandselfhost-linksspecs pass.